//
//  YNSPayReusableFootView.m
//  HNBaseProject
//
//  Created by TR on 2024/7/25.
//

#import "YNSPayReusableFootView.h"

@implementation YNSPayReusableFootView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame])
    {
        self.tLab = [[UILabel alloc]init];
        self.tLab.text = @"支付方式";
        self.tLab.textColor = [UIColor colorWithHexString:@"#000000"];
        self.tLab.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold];
        [self addSubview:self.tLab];
        [self.tLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.offset(35);
            make.left.offset(15);
        }];
        
        self.tButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.tButton setTitle:@"apple pay" forState:UIControlStateNormal];
        [self.tButton setTitleColor:[UIColor colorWithHexString:@"#000000"] forState:UIControlStateNormal];
        self.tButton.titleLabel.font=[UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
        self.tButton.backgroundColor = [UIColor colorWithHexString:@"#F1F8FF"];
        self.tButton.layer.masksToBounds = YES;
        self.tButton.layer.cornerRadius = 5;
        self.tButton.layer.borderWidth =1;
        self.tButton.layer.borderColor = [UIColor colorWithHexString:@"#1D8EFF"].CGColor;
        [self addSubview:self.tButton];
        [self.tButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.tLab.mas_bottom).offset(20);
            make.left.offset(15);
            make.width.offset(168);
            make.height.offset(41);
        }];
        
        self.payButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.payButton setTitle:@"确认支付" forState:UIControlStateNormal];
        [self.payButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.payButton.layer.masksToBounds = YES;
        self.payButton.layer.cornerRadius = 21;
        [self.payButton addTarget:self action:@selector(payClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:self.payButton];
        [self.payButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.tButton.mas_bottom).offset(29);
            make.left.offset(15);
            make.right.offset(-15);
            make.height.offset(44);
        }];
        
        CAGradientLayer *gl = [CAGradientLayer layer];
        gl.frame = CGRectMake(0, 0, kScreenW-30, 42);
        gl.startPoint = CGPointMake(1, 0.45);
        gl.endPoint = CGPointMake(0, 0.5);
        gl.colors = @[(__bridge id)[UIColor colorWithHexString:@"#1D8EFF"].CGColor, (__bridge id)[UIColor colorWithHexString:@"#3BD5C5"].CGColor];
        gl.locations = @[@(0), @(1.0f)];
        [self.payButton.layer addSublayer:gl];
    }
    return self;
}

#pragma mark----支付----
-(void)payClick{
    
}
@end
